package org.hhchat.leetcode.tree;

import org.hhchat.leetcode.dataStruct.TreeNode;

/**
 * Created by hh23485 on 2017/8/22.
 *
 */
public class code101_easy {

    static class Solution {
        public boolean isSymmetric(TreeNode root) {
            if(root==null) return true;
            return isMirror(root.left,root.right);
        }
        public boolean isMirror(TreeNode p, TreeNode q) {
            if(p==null && q==null) return true;
            if(p==null || q==null) return false;
            return (p.val==q.val) && isMirror(p.left,q.right) && isMirror(p.right,q.left);
        }
    }

    public static void main(String[] args){

    }
}
